<form class="form-horizontal">
    <div class="form-group required">
        <label class="control-label" for="json-content">内容</label>
        <textarea id="json-content" class="form-control" rows="20" aria-required="true"></textarea>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button id="submit" type="button" class="btn btn-default">生成markdown table</button>
        </div>
    </div>

    <div class="form-group required">
        <label class="control-label" for="result">结果</label>
        <textarea id="result" class="form-control" rows="20" aria-required="true"></textarea>
    </div>
</form>

<script>
    $("#submit").on('click', function(){
        var data = {
            content : $("#json-content").val(),
            type : "markdown"
        };
        $.post("format", data, function(msg){
            $("#result").val(msg.data);
        }, 'json');
    })
</script>